<template>
  <!--<div id="app">
    <router-view />
  </div>-->
  <v-app style="font-family: '微软雅黑'; background: white">
    <v-content>
      <router-view/>
    </v-content>
  </v-app>
</template>

<script>
export default  {
  name:  'App',
  components: {},
  methods: {
    setUserName() {
      if (this.getCookie("userName") == '' || this.getCookie("userName") == 'undefined') {
        console.log("获取userName失败");
        this.delCookie('userName');
        this.$router.push({path: '/login'});
      } else {
        this.$store.state.userName = this.getCookie("userName");
        this.$store.state.roleName = this.getCookie("roleName");
      }
    },
    delCookie: function (key) {
      var date = new Date();
      date.setTime(date.getTime() - 1);
      var delValue = this.getCookie(key);
      if (delValue != '') {
        document.cookie = key + '=' + escape(delValue) + ';expires=' + date.toUTCString();
      }
    },
    getCookie: function (cname) {
      var name = cname + '='
      var ca = document.cookie.split(';')
      for (var i = 0; i < ca.length; i++) {
        var c = ca[i]
        while (c.charAt(0) === ' ') c = c.substring(1)
        if (c.indexOf(name) !== -1)  return unescape(c.substring(name.length, c.length))
      }
      return ''
    },
  },
  created(){
    //this.setUserName();
  }
    /*metaInfo() {
        return {
            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
            titleTemplate: title => {
                return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
            }
        }
    }*/
}
</script>
